package com.exper;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

public class MyAop<T> implements InvocationHandler {

    private T cObject;

    public MyAop(T o){
        cObject=o;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        before();
        Object o= method.invoke(cObject, args);
        after();
        return o;
    }

    public void before() {
        System.out.println("before");
    }

    public void after() {
        System.out.println("after");
    }
}
